package com.example.consumerservice.controller;

import com.example.consumerservice.service.ProviderServiceFeignClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class FeignController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Resource
    private ProviderServiceFeignClient providerServiceFeignClient;


    @GetMapping("/feign/consumer/msg")
    public String annotationProviderMessage() {
        // 注解方式请求
        String result = providerServiceFeignClient.getMsg();

        //输出响应内容
        logger.info("provider-service 响应数据:" + result);
        //向浏览器返回响应
        return "consumer-service 响应数据:" + result;
    }
}
